<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="assets/css/bootstrap.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="assets/css/font-awesome.min.css" />
    <!--[if IE 7]>
    <link rel="stylesheet" href="assets/css/font-awesome-ie7.min.css" />
    <![endif]-->
    <!--<link rel="stylesheet" href="http://fonts.useso.com/css?family=Open+Sans:400,300" />-->
    <link rel="stylesheet" href="assets/css/ace.min.css" />
    <link rel="stylesheet" href="css/style.css"/>
    <link href="css/jquery.searchableSelect.css" rel="stylesheet" type="text/css">
    <script src="tinymce/tinymce.min.js"></script>
    <script src="js/jquery-1.11.1.min.js"></script>
    <script src="js/jquery.searchableSelect.js"></script>
    <link rel="stylesheet" type="text/css" href="css/xcConfirm.css"/>
    <script src="js/xcConfirm.js" type="text/javascript" charset="utf-8"></script>
    <link type="text/css" rel="stylesheet" href="css/demo.css">
    <link type="text/css" rel="stylesheet" href="css/metroStyle/metroStyle.css">
    <script type="text/javascript" src="js/jquery.ztree.all.js"></script>
    <script type="text/javascript" src="js/MultipleTreeSelect.js"></script>
    <title>修改条款</title>
    <style type="text/css">
        .add{
            line-height: 20px;
            color: #555;
            font-family: Helvetica, Georgia, Arial, sans-serif, 宋体;
            font-size: 13px;
            margin: 0 10px;
        }
        .control-group{
            line-height: 20px;
            color: #555;
            font-family: Helvetica, Georgia, Arial, sans-serif, 宋体;
            font-size: 13px;
            padding-bottom: 8px;
            border-bottom: 1px dotted #dddddd;
            margin-bottom: 8px;
        }
        .control-label{
            color: #555;
            cursor: pointer;
            font-weight: normal;
            line-height: 20px;
            font-family: Helvetica, Georgia, Arial, sans-serif, 宋体;
            font-size: 13px;
            display: inline-block;
            margin-bottom: 0;
            float: left;
            width: 160px;
            text-align: right;
            padding-top: 3px;
        }
        .controls{
            line-height: 20px;
            color: #555;
            font-family: Helvetica, Georgia, Arial, sans-serif, 宋体;
            font-size: 13px;
            margin-left: 180px;
            text-align: left;
            overflow-x: auto;
            overflow-y: hidden;
        }

        .help-inline{
            line-height: 20px;
            font-family: Helvetica, Georgia, Arial, sans-serif, 宋体;
            font-size: 13px;
            text-align: left;
            padding-left: 5px;
            color: #aaaaaa;
            display: inline-block;
            margin-bottom: 0;
            vertical-align: middle;
        }
        button{
            -webkit-tap-highlight-color: rgba(0,0,0,0);
            list-style: none outside none;
            box-sizing: border-box;
            margin: 0;
            text-transform: none;
            cursor: pointer;
            font-size: inherit;
            font-style: inherit;
            font-weight: inherit;
            font-family: "Microsoft YaHei";
            height: 32px;
            background-image: linear-gradient(to bottom,#3b98d6 0,#197ec1 100%)!important;
            background-repeat: repeat-x!important;
            line-height: 32px;
            border: 0px;
            width: 60px;
            text-align: center;
            color: #FFF;
            -webkit-border-radius: 3px;
        }
        .form-actions{
            line-height: 20px;
            color: #555;
            font-family: Helvetica, Georgia, Arial, sans-serif, 宋体;
            font-size: 13px;
            padding: 19px 20px 20px;
            margin-top: 20px;
            background-color: #f5f5f5;
            border-top: 1px solid #e5e5e5;
            padding-left: 180px;
            margin-bottom: 0;
        }
        #tiaokuanneirong button{
            background-image: linear-gradient(to bottom,white 0,white 100%)!important;
        }
        .menuContent{
            margin-left: 200px;
        }
    </style>
</head>
<body>
<div class="page-content">
    <!--条款列表样式-->
    <div class="d_Confirm_Order_style">
        <div class="row">
            <div class="col-xs-12">
                <h3 class="header smaller lighter blue">修改条款</h3>
                <input type="hidden" name="cid" th:value="${clause.getId()}"/>
                <div class="control-group">
                    <label class="control-label">法规：</label>
                    <!--<div class="controls">-->
                    <select style="margin-left: 10px;" name="lawsId">
                        <option value="0">---请选择---</option>
                        <option th:each="laws:${laws}" th:text="${laws.lawsName}" th:value="${laws.id}" th:if="${laws.id} ne ${clause.getLawsId()}"></option>
                        <option th:each="laws2:${laws}" th:text="${laws2.lawsName}" th:value="${laws2.id}" th:if="${laws2.id} eq ${clause.getLawsId()}" selected="selected"></option>
                    </select>
                    <script>
                        $(function () {
                            $("[name='lawsId']").searchableSelect();

                            $("[name='yulan']").click(function(){
                                var activeEditor = tinymce.activeEditor;
                                var editBody = activeEditor.getBody();
                                activeEditor.selection.select(editBody);
                                var neirong = activeEditor.selection.getContent( {'format' : 'text' } );
                                var txt=  neirong;
                                window.wxc.xcConfirm(txt);
                            });

                            var zNodes = [
                                {id: 1, pId: 0, name: "规定",   open: true},
                                {id: 2, pId: 1, name: "标准"},
                                {id: 3, pId: 1, name: "民用航空规章" },
                                {id: 4, pId: 1, name: "规定[备用]"},
                                {id: 5, pId: 1, name: "标准[备用]" },
                                {id: 6, pId: 0, name: "民用航空规章[备用]",open: true},
                                {id: 7, pId: 6, name: "适用性"},
                                {id: 8, pId: 6, name: "双发飞机"},
                                {id: 9, pId: 6, name: "多于两台发动机的飞机"},
                                {id: 10, pId: 6, name: "本分部的每项要求，在申请审定的载重  "} ,
                                {id: 11, pId: 0, name: "［备用］", open: true},
                                {id: 12, pId: 11, name: "飞机的操纵性、稳定性、配平和失速特"},
                                {id: 13, pId: 11, name: "必须制定飞机可以安全运行的重量和重心范围"},
                                {id: 14, pId: 11, name: "载重分布限制不得超过："},
                                {id: 15, pId: 11, name: "［备用］"},
                                {id: 16, pId: 0, name: "最大重量", open: true},
                                {id: 17, pId: 16, name: "最小重量"},
                                {id: 18, pId: 16, name: "重量规定"},
                                {id: 19, pId: 16, name: "申请人选定的极限；"},
                                {id: 20, pId: 16, name: "证明结构符合要求所使用的极限；"},
                            ];
                            var defaults = {
                                textLabel: "jasontext",
                                zNodes: zNodes,
                                height:333,
                                chkStyle: "radio"
                            }

                            $("textarea").drawMultipleTree(defaults);

                        })
                    </script>
                    <span class="help-inline"><font color="red">*</font> </span>
                </div>
                <!--</div>-->
                <div class="control-group">
                    <table>
                        <tr>
                            <label class="control-label">所在目录：</label>
                            <textarea   style="width: 300px;" type="text" readonly th:checks="${clause.getCatalogId()}"></textarea>
                        </tr>
                    </table>
                </div>
                <div class="control-group">
                    <label class="control-label">条款编号：</label>
                    <div class="controls">
                        <input id="clauseId" name="clauseId" class="input-xlarge required" onblur="check()" type="text" th:value="${clause.getClauseId()}" maxlength="32">
                        <span class="help-inline">请输入输入数字和 . 并以数字结尾, 如22.33.44<font color="red" id="clauseNumCheck">*</font> </span>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">条款编号别名：</label>
                    <div class="controls">
                        <input id="clauseAlias" name="clauseAlias" class="input-xlarge " type="text" th:value="${clause.getClauseAlias()}" maxlength="32">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">条款版本号：</label>
                    <div class="controls">
                        <input id="clauseNum" name="clauseNum" class="input-xlarge " type="text" th:value="${clause.getClauseNum()}" maxlength="32">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">条款标题：</label>
                    <div class="controls">
                        <input id="clauseTitle" name="clauseTitle" class="input-xlarge required" type="text" th:value="${clause.getClauseTitle()}" maxlength="64">
                        <span class="help-inline"><font color="red">*</font> </span>
                    </div>
                </div>
                <div class="control-group" id="tiaokuanneirong">
                    <label class="control-label">条款内容：</label>
                    <div style="width: 1000px;margin-left: 190px">
                        <input type="hidden" name="clauseContent" th:value="${clause.getClauseContent()}"/>
                        <div id = "tinymce_demo">
                            <p th:text="${clause.getClauseContent()}"></p>
                        </div>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">关键词：</label>
                    <div class="controls">
                        <input id="keyword" name="keyword" class="input-xlarge " type="text"th:value="${clause.getKeyword()}" maxlength="32">
                    </div>
                </div>
                <script>

                    tinymce.init({
                        selector: '#tinymce_demo', //容器，可使用css选择器
                        language:'zh_CN', //调用放在langs文件夹内的语言包
                        toolbar: true, //工具栏
                        menubar: true, //菜单栏
                        branding:false, //右下角技术支持
                        inline: false, //开启内联模式
                        elementpath: false,
                        min_height:400, //最小高度
                        height: 800,  //高度
                        skin: 'oxide',
                        toolbar_sticky:true,
                        visualchars_default_state:true, //显示不可见字符
                        image_caption: true,
                        paste_data_images: true,
                        relative_urls : false,
                        // remove_script_host : false,
                        removed_menuitems: 'newdocument',  //清除“文件”菜单
                        plugins: "lists,hr, advlist,anchor,autolink,autoresize,charmap,code,codesample,emoticons,fullscreen,image,media,insertdatetime,link,pagebreak,paste,preview,print,searchreplace,table,textcolor,toc,visualchars,wordcount", //依赖lists插件
                        toolbar: 'bullist numlist anchor charmap emoticons fullscreen hr image insertdatetime link media pagebreak paste preview print searchreplace textcolor wordcount',
                        //选中时出现的快捷工具，与插件有依赖关系
                        images_upload_url:'a.php', /*后图片上传接口*/ /*返回值为json类型 {'location':'uploads/jpg'}*/
                        setup: function(editor){
                            editor.on('change',function(){ editor.save(); });
                        }

                    });
                    $(document).click(setcontent());
                    function getbody(){
                        var activeEditor = tinymce.activeEditor;
                        var editBody = activeEditor.getBody();
                        activeEditor.selection.select(editBody);
                        var clauseContent = activeEditor.selection.getContent( {'format' : 'text' } );
                        if(clauseContent==""){
                            alert("请填写条款内容！");
                            return false;
                        }
                        var lawsId=$("[name='lawsId']").val();
                        if(lawsId==""){
                            alert("请选择法规！");
                            return false;
                        }
                        var catalogId=$("[name='catalogId']").val();
                        if(catalogId==""){
                            alert("请选择所在目录！");
                            return false;
                        }
                        var clauseId=$("[name='clauseId']").val();
                        if(clauseId==""){
                            alert("请填写条款编号");
                            return false;
                        }
                        var clauseAlias=$("[name='clauseAlias']").val();
                        var clauseNum=$("[name='clauseNum']").val();
                        var clauseTitle=$("[name='clauseTitle']").val();
                        if(clauseTitle==""){
                            alert("条款标题必填！");
                            return false;
                        }
                        var cid=$("[name='cid']").val();
                        var keyword=$("[name='keyword']").val();
                        location.href="/updateClause?id="+cid+"&lawsId="+lawsId+"&catalogId="+catalogId+"&clauseId="+clauseId+"&clauseAlias="+clauseAlias+"&clauseNum="+clauseNum+"&clauseTitle="+clauseTitle+"&clauseContent="+clauseContent+"&keyword="+keyword+"";
                    }

                </script>
                <div class="form-actions">
                    <button id="btn_search" type="button" class="btn_search" onclick="getbody()">保存</button>&nbsp;&nbsp;
                    <button id="btn_yulan" type="button" class="btn_search" name="yulan">预览</button>&nbsp;&nbsp;
                    <button id="btn_fanhui" type="button" class="btn_search" style="color:black;background-image:linear-gradient(to bottom,white 0,white 100%)!important" onclick="javascript:history.back(-1);">返回</button>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
